require(['layer'], function(layer){

	

	// 注册
	login =  function(){
		$('.submit-login').click(function () {
		var self = $(this),
		form = self.parents("form");//找到祖先元素里面的form元素
		url        = form.attr('action');
		formData   = form.serialize();

		$.post(url,formData,function(json) {
				if (json.code) {
					layer.alert(json.msg,{icon: 1});
					goLocation(json.url,1000);
				} else {
	      			layer.alert(json.msg,{icon: 5});//图标5是为了区分js的报错
	      		}

	      	},"json");
		});
	}

	// 注册
	login();

});

